//
//  ZhuxiaoPopView.m
//  intelligent
//
//  Created by 甘世清 on 2024/2/26.
//

#import "ZhuxiaoPopView.h"

@implementation ZhuxiaoPopView

- (void)SQ_UIViewForSelfView{
    self.backgroundColor = UIColor.clearColor;
    UIView * bgView = [[UIView alloc]init];
    bgView.backgroundColor = UIColor.whiteColor;
    bgView.layer.cornerRadius = 16;
    bgView.clipsToBounds = YES;
    [self addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self).insets(UIEdgeInsetsMake(32, 28, 0, 28));
    }];
    UIImageView * image = [[UIImageView alloc]init];
    image.image = SQGetImage(@"注销账号");
    image.contentMode = UIViewContentModeScaleAspectFit;
    [self addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(64);
            make.top.centerX.equalTo(self);
    }];
    UILabel * label = [[UILabel alloc]init];
    label.text = SQNSLocalString(@"注销账号");
    label.font = FONT_MEDIUM(18);
    label.textColor = SQColor333333;
    [image addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(image);
            make.top.equalTo(image.mas_bottom).offset(11);
    }];
    
    UILabel * label2 = [[UILabel alloc]init];
    label2.text = SQNSLocalString(@"注销后你将失去账号所有权，账号所有会员资格自动清空，账号所有数据清空，无法恢复");
    label2.font = FONT_REGULAR(16);
    label2.numberOfLines = 0;
    label2.textAlignment = NSTextAlignmentCenter;
    label2.textColor = SQColor333333;
    [image addSubview:label2];
    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(image);
            make.top.equalTo(image.mas_bottom).offset(60);
        make.width.mas_equalTo(SCREEN_WIDETH-76);
    }];
    [bgView addSubview:self.rightBtn];
    [self.rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.equalTo(bgView);
        make.height.mas_equalTo(54);
    }];
    WS(weakSelf);
    [LSTTimer addTimerForTime:30 identifier:@"" handle:^(NSString * _Nonnull day, NSString * _Nonnull hour, NSString * _Nonnull minute, NSString * _Nonnull second, NSString * _Nonnull ms) {
        weakSelf.rightBtn.text = [NSString stringWithFormat:@"%@(%@s)",SQNSLocalString(@"确认注销"),second];
    } finish:^(NSString * _Nonnull identifier) {
        weakSelf.rightBtn.text =  SQNSLocalString(@"确认注销");
        weakSelf.rightBtn.backgroundColor = SQColor(@"#FF3B30");
        weakSelf.rightBtn.textColor = SQColor(@"#FFFFFF");
        weakSelf.rightBtn.SQTouchBtn.enabled = YES;
    } pause:^(NSString * _Nonnull identifier) {
        
    }];
    
}

- (SQCustomButton *)rightBtn{
    if (!_rightBtn) {
        _rightBtn = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(0, 0) midmargin:0];
        _rightBtn.text = SQNSLocalString(@"确认注销");
        _rightBtn.textColor = SQColor999999;
        _rightBtn.font = FONT_REGULAR(16);
        _rightBtn.backgroundColor = SQColor(@"#D8D8D8");
        _rightBtn.SQTouchBtn.enabled = NO;
    }
    return _rightBtn;
}
@end
